"""
======================
@author:SUNLIN
@time:2025/3/4 18:49
@email:1232@163.com
======================
"""
import average
import numpy as np;

# sum
list1 = [1, 2, 3, 4]
print(sum(list1))


def get_sum(list):
    sum = 0
    for num in list:
        sum += num

    # 数据项个数
    count = len(list1)
    # 数据项平均值
    average = sum / count
    return sum


def get_avg(list):
    sum = 0
    for num in list:
        sum += num

    # 数据项个数
    count = len(list1)
    # 数据项平均值
    average = sum / count
    return average


print(get_sum(list1))

print(np.average(list1))
print(get_avg(list1))

# 制作牛奶咖啡
coffee = 10
milk = 20
stand_cof = 15
stand_milk = 25


def make_milkcoffee(stand_cof, stand_milk, coffee, milk):
    # 判断咖啡浓度
    while coffee < stand_cof:
        # 如果没有达到标准，继续加咖啡
        coffee = coffee + 3
        print("当前咖啡浓度：", coffee)
    print("咖啡浓度足够，准备加牛奶！")
    # 判断牛奶
    while milk < stand_milk:
        # 如果没有达到标准，继续加咖啡
        milk = milk + 3
        print("当前牛奶浓度：", milk)
    print("牛奶浓度足够，完成牛奶咖啡的制作！")


make_milkcoffee(stand_cof, stand_milk, coffee, milk)
